# -*- coding: utf-8 -*-
# @Time : 2023/10/28 19:09
# @Author : zxp

import socket

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 8001))

wel = client.recv(1024)  # 接收消息
print(wel.decode('utf-8'))

while True:
    question = input("请提问(q/Q退出):")
    if question.strip().upper() == 'Q':
        break
    client.sendall(question.encode('utf-8'))
    reply = client.recv(1024)
    print(reply.decode('utf-8'))
client.close()

